package infaraway.observer;

import org.jcp.xml.dsig.internal.SignerOutputStream;

/**
 * Created by :Infaraway
 * DATE : 2017/4/25
 * Time : 23:37
 * Funtion :
 */
public class Observer1 implements Observer {
    private String temperature;
    private String humidity;
    private String pressure;

    private Subject weatherData;

    public Observer1(Subject weatherData) {
        this.weatherData = weatherData;
        weatherData.registerObserver(this);
    }

    @Override
    public void updateNotify(String temperature, String humidity, String pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        this.pressure = pressure;
        display();
    }

    @Override
    public void display() {
        System.out.println("this is Observer 1 ...");
        System.out.println("Oberver1{" +
                "temperature='" + temperature + '\'' +
                ", humidity='" + humidity + '\'' +
                ", pressure='" + pressure + '\'' +
                '}');
    }
}
